package com.knife.oauth.api.controller.v1;

import com.knife.common.utils.Results;
import com.knife.oauth.api.vo.IamMenuTree;
import com.knife.oauth.app.service.IamRoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 角色菜单关联(IamRoleMenu)表控制层
 *
 * @author tianhao.luo@hand-china.com
 * @since 2025-08-13 14:19:30
 */

@RestController("iamRoleMenuController.v1")
@RequestMapping("/v1/{organizationId}/iam-role-menus")
public class IamRoleMenuController {
    @Autowired
    private IamRoleMenuService iamRoleMenuService;

    @GetMapping("/tree")
    public ResponseEntity<List<IamMenuTree>> selectTree(@PathVariable Long organizationId) throws IllegalAccessException {
        return Results.success(iamRoleMenuService.selectTree(organizationId));
    }
}

